package com.chzc.fm.duotin.ui.other;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chzc.fm.duotin.R;
import com.chzc.fm.duotin.utils.LogUtil;

public class LoginActivity extends BaseActivity implements View.OnClickListener{

    //邮箱注册，qq、微博注册
    private TextView tvMailRegister, tvQQLogin, tvSinaLogin;

    //已有账号，先用用看
    private TextView tvHasAccount, tvExit;

    //根布局
    private RelativeLayout rlRoot;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_login;
    }

    @Override
    protected void initViews() {
        tvMailRegister = (TextView) findViewById(R.id.tv_register_account);
        tvQQLogin = (TextView) findViewById(R.id.tv_qq_login);
        tvSinaLogin = (TextView) findViewById(R.id.tv_sina_login);
        tvHasAccount = (TextView) findViewById(R.id.tv_has_account);
        tvExit = (TextView) findViewById(R.id.tv_fore_use);
        rlRoot = (RelativeLayout) findViewById(R.id.rl_root_login);
    }

    @Override
    protected void initEvents() {
        tvMailRegister.setOnClickListener(this);
        tvQQLogin.setOnClickListener(this);
        tvSinaLogin.setOnClickListener(this);
        tvHasAccount.setOnClickListener(this);
        tvExit.setOnClickListener(this);
    }

    @Override
    protected void init() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_register_account:
                startRegisterActivity();
                break;
            case R.id.tv_qq_login:
                break;
            case R.id.tv_sina_login:
                break;
            case R.id.tv_has_account:
                startLoginActivity();
                break;
            case R.id.tv_fore_use:
                exitActivity();
                break;

        }
    }

    /**
     * 开启注册界面
     */
    private void startRegisterActivity() {
        Intent i = new Intent(LoginActivity.this, RegisterActivity.class);
        startActivity(i);
        exitActivity();
    }

    /**
     * 开启登录界面
     */
    private void startLoginActivity() {
        Intent i = new Intent(LoginActivity.this, LoginDuotinActivity.class);
        startActivity(i);
        exitActivity();
    }

    /**
     * 退出Activity
     */
    private void exitActivity() {
        finish();
    }

    @Override
    public void onBackPressed() {
        exitActivity();
    }

    @Override
    public void finish() {
        super.finish();
    }
}
